<!DOCTYPE html>
<html lang="zh_CN">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title></title>
	<meta name="viewport" content="initial-scale=1, maximum-scale=1">
	<!-- <link rel="shortcut icon" href="http://favicon.ico"> -->
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="viewport" content="width=device-width, height=device-height, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">

	<!--<link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">-->

	<!-- 固定的css 和 common.js 的引用    -->
	<link rel="stylesheet" href="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/css/sm.min.css">
	<link rel="stylesheet" href="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/css/sm-extend.min.css">
	<link href="https://cdn.bootcss.com/Swiper/4.0.6/css/swiper.min.css" rel="stylesheet">
	<script type="text/javascript" src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/common/common/common.js"></script>

	<style type="text/css">
  	/*css 的样式都放在这里*/

  	body{padding: 0;margin: 0;background-color: white;}
  	
	#list_ul{
		margin-top: -32px;
		margin-bottom: -32px;
		display: -webkit-flex;
		display: flex;
		flex-wrap: wrap;
	}
    #list_ul li{
	   width:46%;
	   height:40%;
	   float: left;
	   margin-left:2.6%;
	   padding-bottom: 0.2rem;
	 }
	 #it_iner {
	    width: 100%;
	    height:100%;
	    overflow: hidden;
	    /*padding:0;*/
	 }
	 #it_iner .item-title{
	    width:100%;
	    height:100%;
	    text-align: center;
	 }
	 #it_iner  img{
	   display:block;
	   width:100%;
	 }
	/*设置字体大小*/
	#wenz{
	    display: inline-block;
	    text-align:justify;
	    white-space:normal;
	    font-size:0.6rem;
	    color:black;
	}
	.goods_list{
		padding-top:15px;
        padding-bottom:15px;
        padding-left:5px;
        padding-right:5px;
        text-align: center;
        width: 46%;
	}
	#label_content{
		white-space:nowrap;
		text-overflow:ellipsis;
		overflow:hidden;
		text-align: center;
	}
	.price_style{
		size:1;
	}
	#goods_img{
		text-align: center;
	}
	.price_style{
		color: darkgray;
	}
	.goods img{
		/*height:150px;*/
		width:90%;
		margin-right: 5%;
		margin-left: 5%;
	}
	.goods{
		width: 80%;
		margin:auto;
		padding-top: 10px;
		padding-bottom: 10px;
		/*box-shadow: 2px 2px 2px #D8D8D8;*/
		box-shadow: -1px 0 0 #D8D8D8, 
   			0px -1px 0px #D8D8D8, 
   			2px 2px 2px #D8D8D8, 
   			2px 2px 2px #D8D8D8;
	}
	.goods_add{
		width: 80%;
		margin:auto;
		padding-top: 10px;
		padding-bottom: 10px;
		border:2px solid #D8D8D8;
	}
	.goods_add img{
		margin:auto;
		margin-top: 10px;
		width:98%;
		text-align: center;
	}
	#label_content_add{
		margin-top: 20px;
	}
	#img_delete{
		width: 30px;
		height:30px;
		margin-top:-20px;
		margin-left:-10px;
		position: absolute;
	}

   /*视频标志*/
   #videologo{
     display:block;
     width: 0.8rem;
     height: 0.8rem;
     margin: 1% 5%;
   }
    #videologo img{
	    display: block;
	    width: 100%;
	 }

</style>
</head>
<body>
	<div id= "body">
		<div id="main" class="content">
			<!--商品列表-->
			<div id="list">
					<div class="list-block">
						<ul id="list_ul">
							<!-- <li class="item-content"id="imli">
								<div class="item-inner" id="it_iner">
									<div class="item-title">
										<img  src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/img/img/shu.jpg">
										<span id="wenz">语文小学一年级上册</span>
									</div>
								</div>
							</li>
							<li class="item-content"id="imli">
								<div class="item-inner" id="it_iner">
									<div class="item-title">
										<img  src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/img/img/shu.jpg">
										<span id="wenz">语文小学一年级上册</span>
									</div>
								</div>
							</li>
							<li class="item-content"id="imli">
								<div class="item-inner" id="it_iner">
									<div class="item-title">
										<img  src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/img/img/shu.jpg">
										<span id="wenz">语文小学一年级上册</span>
									</div>
								</div>
							</li> -->
<!-- <li class="goods_list"  cid="'+book_id+'" onclick="onbook(this)">
							          	<div class="goods">
							          		
							          		<div id="goods_img">
							          			<img src="../img/img_delete_book.png" id="img_delete" onclick="ondelete(this)" />
							          			<img src="../img/temp_bookindex.png" id="img_photo"/>

							          		</div>
							          		<div id="label_content">
							          			<div class="name"><font size="3">dddddd</font></div>
							          			<div class="price">
							          				<font size="2" class="price_style">fjdlsj</font>
							          			</div>
							          		</div>
							          	</div>
							          </li> -->
						</ul>
					</div>
			</div>
		</div>
</div>





<!-- 固定的js引用，所有的jQuery 要用 $$ 表示 -->
<script type="text/javascript" src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/js/js/jquery-1.11.1.min.js"></script>
<!-- 这一行代码是为了 避免js冲突 -->
<script src="https://cdn.bootcss.com/Swiper/4.0.6/js/swiper.min.js"></script>
<script type="text/javascript">var $$ =jQuery.noConflict();</script>

<script type='text/javascript' src='https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/zepto/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/js/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/js/js/sm-extend.min.js' charset='utf-8'></script>
<script type="text/javascript" src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/common/common/common.js"></script>

<script type="text/javascript">
// 函数区域，函数放在“初始化区域的上面”
	var isdelete = false;//默认是没有开启denlete模式
    var arraydata = new Array();
    var curbooks = new Array();//当前的book数组

      function getParams(curdata){
	    // data需要转成json调用 ，函数urlParamParseJson();
 		// var jsonData = urlParamParseJson(escape2Html(data));
 		var data = JSON.parse(escape2Html(curdata));
 		$$("#list_ul").html("");
 		if(data){
 			curbooks = new Array();//当前的book数组
 			var books = data.all_books;
 			// alert(JSON.stringify(data));
 			if(isNotNull(books)){
 				// alert(JSON.stringify(data));
				for(var q=0;q<books.length;q++){
						var book = books[q];
 						var book_id = "";
 						var book_name = "";
 						var book_price = "";
 						var book_img = "";
 						var curbooktype = 0;
 						var videourl = "";
 						var strbooktypeshow = "";

						curbooks.push(book);
 						if(isNotNull(book.book_id)){
 							book_id = book.book_id;
 						}

 						if(isNotNull(book.zipname)){
 							videourl = book.zipname;
 						}

 						if(isNotNull(book.booktype)){
 							curbooktype = book.booktype;
 						}
                		
                		if(isNotNull(book.book.category)){
 							book_name = book.book.category;
 						}

 						if(isNotNull(book.book.name)){
 							book_price = book.book.name;
 						}

 						if(isNotNull(book.book.img)){
 							book_img = book.book.img;
 						}

 						if(curbooktype == '1' || curbooktype == 1){
 							strbooktypeshow = '<a href="#" id="videologo"><img  src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/img/img/video.png"></a>';
 						}

                		
                		var str = '\
							<li class="goods_list" onclick="onbook(this)" videourl="'+videourl+'" ctype="'+curbooktype+'" bookid="'+book_id+'" cid="'+book_id+''+curbooktype+'" curposition = "'+q+'">\
							          	<div class="goods">\
							          		<div id="goods_img">\
							          		<img src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/img/img/img_delete_book.png" id="img_delete" class="img_delete_img" hidden " />\
							          			<img src="'+book_img+'" />\
							          		</div>\
							          		<div id="label_content">'+strbooktypeshow+'\
							          			<div class="name"><font size="3">'+book_name+'</font></div>\
							          			<div class="price">\
							          				<font size="2" class="price_style">'+book_price+'</font>\
							          			</div>\
							          		</div>\
							          	</div>\
							          </li>\
							          ';
						$$("#list_ul").append(str);
            	}
 			}
        }

        	if(isIOSApply == '1' && isIOS()){
    		}else{
    			                		var book_name = "添加资源";
    			                		var str = '\
    										<li class="goods_list" onclick="onaddbook(this)" id="goods_list_add">\
    										          	<div class="goods_add">\
    										          		<div id="goods_img">\
    										          			<img src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/img/img/img_add.png" />\
    										          		</div>\
    										          	</div>\
    										          	<div id="label_content_add">\
    										          			<div id="" class="name"><font size="3">'+book_name+'</font></div>\
    										          		</div>\
    										          </li>\
    										          ';
    									$$("#list_ul").append(str);


    		}
                		

						if(isdelete){
								$$("#goods_list_add").hide();
						       $$(".img_delete_img").show();    //如果元素为隐藏,则将它显现
						}else{
							  $$("#goods_list_add").show();
						      $$(".img_delete_img").hide();     //如果元素为显现,则将其隐藏
						}



		if(isIOSApply == '1' && isIOS()){
			if(!isNotNull($$("#list_ul").html())){
				native_showdialog("您当前没有图书，可以到商城中去任意下载图书");
			}
		}
  	}

	function onbook(onthis){
		var cid = $$(onthis).attr("cid");
		var cbook_id = $$(onthis).attr("bookid");
		
		var position = Number($$(onthis).attr("curposition"));
		if(isdelete){
			var params = {
				type:'book_item_click_delete',
				book_id:cid+''
			};
			send_data(params);
		}else{
			var clickbooktype = $$(onthis).attr("ctype");;//默认图书类型是图书0， 1：视频
			var strbook = '';
			var curbook = curbooks[position];

			if(clickbooktype == 1 || clickbooktype == '1'){//视频
				
				var viou = $$(onthis).attr("videourl");
				if(isNotNull(viou)){
					native_goto('local/videoplay?url='+viou+'&cid='+cbook_id);
				}
				
				// 
			}else{//图书


				if(isNotNull(curbook)){
					strbook = JSON.stringify(curbook);
				}
				var params = {
					type:'book_item_click',
					book: strbook
				};
				send_data(params);
			}

			
		}
		// var params = JSON.stringify(chuancan);
		// native_goto('local/shangpinxiangqing?item=');
		
		
	}

	function changeDelete(ctitle){
		// if($$("#img_delete").is(":hidden")){
		// 		isdelete = true;
		// 		$$("#goods_list_add").hide();
		//        $$("#img_delete").show();    //如果元素为隐藏,则将它显现
		// }else{
		// 		isdelete = false;
		// 		$$("#goods_list_add").show();
		//       $$("#img_delete").hide();     //如果元素为显现,则将其隐藏
		// }

		if(ctitle == '取消编辑'){
				isdelete = true;
				$$("#goods_list_add").hide();
		       $$(".img_delete_img").show();    //如果元素为隐藏,则将它显现
		}else{
				isdelete = false;
				$$("#goods_list_add").show();
		      $$(".img_delete_img").hide();     //如果元素为显现,则将其隐藏
		}
	}

	function onaddbook(onthis){
		var params = {
			type:'show_addbook_dialog'
		};
		send_data(params);
		
	}

	// 初始化区域
    $(function () {
		
        $.init();
    });
  
</script>
</body>
</html>